define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		/**
		 * 一键切换数据获取方式
		 * @param {Object} result
		 */
		function get_data_list(result){
			if(true){
				result = '{"success": true,"msg": "","result": ' +
						'{"doing": [{"act_id": "act_id_001","name": "新年促销2","goods_count": 10,"member_count": 100,"start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img01.jpg"}},{"act_id": "act_id_002","name": "新年促销","goods_count": 10,"member_count": 100,"start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img01.jpg"}}],' +
						'"pending": [{"act_id": "act_id_003","name": "新客户促销","goods_count": 10,"start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img01.jpg"}},{"act_id": "act_id_004","name": "新客户促销","goods_count": 10,"start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img01.jpg"}}],' +
						'"ended": [{"act_id": "act_id_005","name": "圣诞促销","goods_count": 10,"member_count": 100,"start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img01.jpg"}},{"act_id": "act_id_006","name": "圣诞促销","goods_count": 10,"member_count": 100,"start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img01.jpg"}}]},' +
						'"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}
		function get_data_productextent_list(result){
			if(true){
				result = '{"success":true,"msg":"","result":{"act":[{"act_id":"act_id_001","act_name":"新年促销","store_id":"001","store_name":"上海五金店","introduction":"新年促销大让利","goods_count":10,"member_count":100,"start_time":"2017/01/01 09:00:00","end_time":"2017/01/31 09:00:00","image":{"id":"001","image":"./img/upload/pro-img01.jpg"}},{"act_id":"act_id_002","act_name":"新年促销","store_id":"002","store_name":"北京五金店","introduction":"新年促销大让利","goods_count":10,"member_count":100,"start_time":"2017/01/01 09:00:00","end_time":"2017/01/31 09:00:00","image":{"id":"001","image":"./img/upload/pro-img01.jpg"}}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			}else
			return result;
		}
		//返回信息
		return {
			//获取数据
			productextent_list:function(nPage,callback,calldone){
				Http.post({
					method:'marketing.promotion.viewlist',
					act_type:2,
					pagelimit:20,
					nPage:nPage,
					picSize:'CS'
				},function(result){
					if(callback)
					callback(get_data_productextent_list(result).result);
				},function(e){
					
				},function(){
					if(calldone)
					calldone();
				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Productextent", factory);
});